package cn.tedu.review.cn.tedu.oop;

/**
 * 该类用于练习opp第一大特性：封装
 *
 * @author ：Dsi
 * @date ：2021/11/5 15:06
 */
public class TestPrivate02 {
    public static void main(String[] args) {
        Student student = new Student();
        //student.name="张三";
        student.sano = 123;
        // student.subject="java";
        //  System.out.println(student.name);
        System.out.println(student.sano);
        // System.out.println(student.subject);

        student.study();
        student.eat();
        student.sleep();

        student.setName("李四");
        System.out.println(student.getName());
        student.setSubject("Phython");
        System.out.println(student.getSubject());
    }
}

class Student {
    int sano;
    private String name;
    private String subject;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public void eat() {
        System.out.println("吃饭");
    }
    public void sleep() {
        System.out.println("不睡觉，只学java");
    }
    public void study() {
        System.out.println("学习ing");
    }
}
